home *** CD-ROM | disk | FTP | other *** search
/ Celestin Apprentice 4 / Apprentice-Release4.iso / Languages / THIN C 2.0 / Projects / structSize / structSize.c next >
Encoding:
C/C++ Source or Header  |  1994-02-02  |  511 b   |  28 lines  |  [TEXT/THIN]

  1. #define MAX_ARTIST_CHARS    50
  2. #define MAX_TITLE_CHARS        50
  3.  
  4. struct CDInfo
  5. {
  6.     char    rating;
  7.     char    artist[ MAX_ARTIST_CHARS ];
  8.     char    title[ MAX_TITLE_CHARS ];
  9. };
  10.  
  11. main()
  12. {
  13.     struct CDInfo    myInfo;
  14.     
  15.     printf( "rating field:    %ld bytes\n",
  16.             sizeof( myInfo.rating ) );
  17.     
  18.     printf( "artist field:   %ld bytes\n",
  19.             sizeof( myInfo.artist ) );
  20.     
  21.     printf( "title field:    %ld bytes\n",
  22.             sizeof( myInfo.title ) );
  23.     
  24.     printf( "               ---------\n" );
  25.     
  26.     printf( "myInfo struct: %ld bytes",
  27.             sizeof( myInfo ) );
  28. }